import QtQuick 1.0

Rectangle {
    id: imageRoot

    // color applied to the reflection fade
    property string fadeColor : "#000000"

    // the image source
    property string source

    // ratio of the original image to be reflected
    property real reflectRatio : 0.5

    clip: true
    color: fadeColor
    width: originalImage.width
    height: originalImage.height * (1 + reflectRatio)

    Image {
	id: originalImage

	source: imageRoot.source
    }

    Image {
	id: reflectedImage

	anchors.top: originalImage.bottom
	source: imageRoot.source

	transform: Rotation {
	     origin.x: reflectedImage.width / 2
	     origin.y: reflectedImage.height / 2
	     axis.x: 1; axis.y: 0; axis.z: 0
	     angle: 180
	 }
    }

    Rectangle {
	anchors.top: originalImage.bottom
	width:  originalImage.width
	height: originalImage.height * reflectRatio

	gradient: Gradient {

	    GradientStop {
		position: 0.0
		color: "#00" + fadeColor.substring(1)
	    }
	    GradientStop {
		position: 1.0
		color: "#FF" + fadeColor.substring(1)
	    }
	}
    }
}
